Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update the README #2

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Update the README #2

wants to merge 1 commit into from

Conversation

jhaaaa
Copy link

@jhaaaa jhaaaa commented Aug 23, 2024

First pass written with help from ChatGPT. 😅


In the `broadcast-example-api` directory, create a `generateAndPrintKeys.ts` file with the following contents.

Replace `<YOUR_PRIVATE_KEY>` with the private key for the wallet address you want to use as the broadcast address.
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no idea if there is a better way to get the key bundle - but this is the route ChatGPT took me down. =P Please advise!

@jhaaaa jhaaaa requested review from alexrisch and rygine August 23, 2024 22:10

To use this example broadcast API to try out the flow to subscribe to a broadcast with built-in consent, use it with the [subscribe-broadcast repo](https://github.com/xmtp/subscribe-broadcast).

To learn how, see [Try the subscribe with built-in consent and broadcast flow](https://docs.xmtp.org/consent/subscribe-broadcast).
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do https://www.npmjs.com/package/@xmtp/broadcast-sdk and https://github.com/alexrisch/broadcaster-app come into the picture? Is there an opportunity to surface them in this README?


export const generateAndPrintKeys = async (signer: Signer) => {
const clientOptions = {
env: "production", // this works even if in .env, XMTP_ENV=dev. if set this to dev, key bundle doesn't work.
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't get what is going on with this. =)

In my .env file, XMTP_ENV=dev - and the key bundle this script generates when this value is set to production works.

However, if I set this value to dev in this script, to match the env in my .env file, the generated key bundle doesn't work.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm that doesn't seem right, they should have to match

At the top of the `src/index.ts` file, add the following line. This will load all variables from your `.env` file into `process.env`.

```tsx
import "dotenv/config";
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added this to the file to make things work...but there is an existing line: import dotenv from "dotenv";

The commands weren't working for me without import "dotenv/config";.

Not sure if both are necessary? Could also be user error on my part!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants